import 'dart:ffi';

void main() {
  Future<String> future = getData();

  future.then((value) {
    print(value);
  }, onError: (error) {
    print(error);
  });
}

Future<String> getData() async {
  return await Future.delayed(Duration(seconds: 2), () {
    throw AssertionError("error");
    // return "网络数据";
  });
}
